Release 10.1A: OpenEdge Getting Started:
Progress OpenEdge Studio
Detailed Order section procedure
The following sections describe building the Order section in detail.
Adding a SDO for orders
As in the Customer section, the SDOs are the first objects to add to the Order section. The Order section needs SDOs that query the database for orders and the order lines that make up that order.
![]()
To add an Order SDO:
- Choose the SDO icon
in the Object Palette to open the Choose SmartDataObject dialog box.
- Select
dorder.wand choose OK.- Click once in the Order section. You do not need to position a SDO precisely, since it is invisible when an application is running. The Progress Advisor notifies you that the SDO instance,
h_dorder,can be a Data Target for some other SmartObject, and offers to add a Data SmartLink from the SDO instance,h_dcust.- Select the radio button to create the SmartLink and choose OK. The Progress Advisor notifies you that
h_dorderandh_dcustare both Query Objects, and asks whether you want to specify foreign fields:
![]()
- Select the radio button to choose foreign fields and choose OK. The Multi-Field Mapping dialog box appears.
- Select
CustNumin the Source andOrder.CustNumin the Target list:
![]()
- Choose Map. The field pair is displayed in the Mapped Fields field.
- Choose OK. The new SDO,
dorder.w, appears in the main window.Adding a SDO for order lines
You are now going to add another SDO,
dordlne,to the Order section.
![]()
To add an Order Lines SDO:
- Choose the SDO icon
in the Object Palette to open the Choose SmartDataObject dialog box.
- Select
dordlne.wand choose OK.- Place the new SDO under the other SDO. This is only for convenience, their positions do not affect how they operate. The Progress Advisor notifies you that the SDO instance,
h_dordlne, can be a Data Target for some other SmartObject, and offers to add a Data SmartLink from either of the other SDO instances:
![]()
- Choose the radio button to create the SmartLink to
h_dorderand choose OK. The Progress Advisor notifies you thath_dordlneandh_dorderare both Query Objects and asks if you want to choose foreign fields.- Choose the radio button to select foreign fields and then choose OK. The Multi-Field Mapping dialog box appears.
- Select
Ordernumin the Source list andOrderLine.Ordernumin the Target list.- Choose Map. The field pair is displayed in the Mapped Fields field.
- Choose OK. The new SDO,
dordlne, appears in the design window:
![]()
- Save your work.
Adding a SDV
The next object to add is a SDV that displays the order information.
![]()
To add a SDV for displaying order information:
- Choose the SDV icon
in the Object Palette to open the Choose SmartDataViewer dialog box.
- Select
vorder.wand choose OK.- Click within the Order section to add the SDV. The Progress Advisor notifies you that SDV instance,
h_vorder, should be a Data Target for some other SmartObject, and offers to create a Data SmartLink from the SDO instance,h_dorder.- Select the radio button to create the SmartLink and choose OK. The Progress Advisor notifies you that the SDV instance,
h_vorder, should be an Update source for some other SmartObject, and offers to add an Update SmartLink to the SDO instance,h_dorder.- Select the radio button to create the SmartLink and choose OK. The SDV appears in the main window.
- Position the SDV near the top of the Order section and aligned on the right edge. Your window should look something like the following figure:
![]()
Adding buttons to the Order section
You need to add buttons to the Order section, as you did to the Customer section. Follow the procedures in "Creating and positioning the buttons" section and "Adding ToolTips, help IDs, and images to the buttons" section to add and customize the three buttons to the Order section.
![]()
To customize the buttons, use the values in the following table:
Object Left Height Width ToolTip Help ID Image BUTTON-3 14 2.38 10 Place New Order 3 BUTTON-4 14 2.38 10 Find Order 4 BUTTON-5 14 2.38 10 Maintain Order 5Note: You do not need to add a Help file for the Order section buttons. The Help file you added while building the Customer section controls the Help for the entire window. It applies to all sections of the window.
When you finish, your window should look like the following window:
![]()
Coding event triggers for the Order buttons
You need to add
CHOOSEevent triggers to the buttons, as you did in the Customer section. Follow the procedures in "Coding event triggers for the buttons" section.Using the Section Editor, add the following code to the
CHOOSEevents of the buttons in this section:
The remaining objects to add to the Order section are two Object Component Extension (OCX) controls, also known as ActiveX controls.
Adding OCX controls
In this section, you add Object Component Extension (OCX) controls to your window. An OCX (also called an ActiveX control) is a predefined object widget that you include in a control-frame to add prepackaged functionality to your applications.
ActiveX objects are Common Object Model (COM) objects that provide a form of interprocess communication with other Windows applications along the Microsoft ActiveX specifications. For more information about ActiveX Automation, see the OpenEdge Development: Programming Interfaces manual.
The OpenEdge Studio ships with three licensed OCX controls:
With the AppBuilder, you can integrate third-party objects, like OCXs, into your applications in the same way you build SmartObjects. For example, in this section, you choose the OCX spin box from the Object Palette, position and resize it visually in the window, and write user-interface triggers for it using the Section Editor. For more detailed information about ActiveX (OCX controls) and the AppBuilder, see the OpenEdge Development: AppBuilder .
Selecting an OCX object
In this section, you add two OCX spin box controls to the Order section. These OCX controls are used to navigate through the records in the SDO,
dorder, which sends the order information to the SDV,vorder, for viewing.
![]()
To add OCX controls to the Order section:
- Double-click the OCX icon
in the Object Palette. The Choose Control dialog box appears:
Note: If you installed other OCX controls, they should also appear in the Available Controls list.
![]()
- Select the Crescent Spin Control in the Available Controls list. When you select an OCX control, the location and control name appear at the bottom of the Choose Control dialog box.
- Choose OK to return to your design window.
- Add two spin boxes to the Order section. The spin boxes appear with their default dimensions. Your window should appear similar to the following window:
![]()
Changing the appearance of the OCX controls
The OCX spin boxes are too large and oriented in the wrong direction. You need to resize the OCX spin boxes, change their orientation, and add text labels and borders.
![]()
To resize the OCX spin boxes and change their orientation:
- Use the Window
Properties Window option in the AppBuilder menu to set the control frames’ Heights to 1.52 and their Widths to 9.0.
See the "Creating and positioning the buttons" section for information on using the Properties Window.
- Double-click the left spin box to open the Property Editor dialog box:
![]()
- Select the Style property and set it to Style 3 - 3D Horizontal.
- Select the ArrowColor property and set it to dark blue.
- Close the property sheet.
- Repeat Step 2 through Step 5 for the right spin box. Your window should now look something like this:
![]()
- Use the Text icon
in the Object Palette to add the colored text labels, Prev/Next, below the left spin box and First/Last below the right spin box. See the "Adding text labels to the sections" section to review this procedure.
- Use the Rectangle icon
in the Object Palette to add a rectangle around each spin box:
![]()
Coding the Prev/Next spin box to fetch the previous record
You need to code the OCX controls in your window to navigate through the Order records. First, you will code the Prev/Next spin box to fetch the previous record.
![]()
To add trigger code to fetch the previous record:
- Select the Prev/Next spin box and open the Section Editor.
- Choose the New button to open the Choose Event dialog box:
![]()
- Select OCX.SpinDown from the Common OCX Events list. The Section Editor now displays the new code section:
![]()
- Position the cursor between the Header comments and the
END PROCEDUREstatement.- Choose the Insert Call button to open the Insert Procedure Call dialog box:
![]()
- Select
h_dorderfrom the Procedure Object drop-down list.- Select the Procedures radio button in the Entries in Object section, and select
fetchPrev. The Code to Insert field shows a preview of the code for this procedure call:
![]()
- Choose OK. The new code appears in the Section Editor:
![]()
Coding the Prev/Next spin box to fetch the next record
Now, you need to code the Prev/Next spin box to fetch the next record.
![]()
To add trigger code to fetch the next record:
- Choose New in the Section Editor to open the Choose Event dialog box.
- Select OCX.SpinUp in the Common OCX Events list.
- Position the cursor between the Header comments and the
END PROCEDUREstatement.- Choose the Insert Call button to open the Insert Procedure Call dialog box.
- Select
h_dorderfrom the Procedure Object drop-down list.- Select the Procedures radio button in the Entries in Object section.
- Select
fetchNextand choose OK. The new trigger code appears in the Section Editor.- Choose File
Close Window to save the new code and close the Section Editor.
Coding the First/Last spin box to fetch the first and last records
The second spin box fetches the first or last record in the Order SDO. The only thing that differs from what you did for the Prev/Next spin box is the procedure called by the spin events. First, you add the code to fetch the first record.
![]()
To add trigger code to fetch the first record, repeat the procedure in "Coding the Prev/Next spin box to fetch the previous record" section. Use the
fetchFirstprocedure, instead of thefetchPrevprocedure.Now, you add the code to fetch the last record.
![]()
To add trigger code to fetch the last record, repeat the procedure in "Coding the Prev/Next spin box to fetch the next record" section. Use the
fetchLastprocedure, instead of thefetchNextprocedure.You can now save your window and have a look at how it runs so far.
Viewing the window
You have now completed assembling the Customer and Order sections of the application’s main window. If you want to view and test the partially assembled application, run the application to view the window at this point in the assembly. Before you run the application, save your work.
![]()
To view the partially assembled window:
- Choose the Run icon
on the AppBuilder toolbar. Your window should appear as it would in a running application. The main window of the sample application should look like the following window:
![]()
- Hold your pointer over a button to view the ToolTip.
- Choose the context sensitive help button (?) in the upper-right corner of the window and then choose a button to see the context sensitive help.
- Choose one of the buttons to launch another module.
- Choose the Stop icon
on the AppBuilder toolbar to return to the main window.
Now you can move on to building the Order Line section.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |